package st.business.tepth.business.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * @author zhangyu
 * @date 2019/2/13
 */
public class CommonBean implements Parcelable {
    private String name;
    private int id;
    private boolean isSelected;

    public CommonBean() {
    }

    public CommonBean(String name, int id) {
        this.name = name;
        this.id = id;
    }

    public boolean isSelected() {
        return isSelected;
    }

    public void setSelected(boolean selected) {
        isSelected = selected;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.name);
        dest.writeInt(this.id);
        dest.writeByte(this.isSelected ? (byte) 1 : (byte) 0);
    }

    protected CommonBean(Parcel in) {
        this.name = in.readString();
        this.id = in.readInt();
        this.isSelected = in.readByte() != 0;
    }

    public static final Parcelable.Creator<CommonBean> CREATOR = new Parcelable.Creator<CommonBean>() {
        @Override
        public CommonBean createFromParcel(Parcel source) {
            return new CommonBean(source);
        }

        @Override
        public CommonBean[] newArray(int size) {
            return new CommonBean[size];
        }
    };

    @Override
    public String toString() {
        return name;
    }
}
